﻿using Beetle;
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;

internal class Class_x
{
    public static DateTime _field_a = DateTime.Now;
    public bool _field_b;
    public string _field_c;
    public string _field_d;
    public int _field_e;
    public DateTime _field_f;
    private static Class_x _field_g = null;
    private static object _field_h = null;
    internal static string _field_i = "73HWrM6iCrk=";
    private static string[] _field_j;
    private static string[] _field_k;
    private static string _field_l;
    private static string _field_m;
    private static StreamReader _field_n;
    private static string _field_o;

    static Class_x()
    {
        _field_h = new RSACryptoServiceProvider(0x800);
    }

    private int a()
    {
        return this._field_e;
    }

    public static byte[] a(byte[] A_0)
    {
        return ((RSACryptoServiceProvider) _field_h).Decrypt(A_0, false);
    }

    private static void a(string A_0)
    {
        ((RSACryptoServiceProvider) _field_h).FromXmlString(_field_m);
    }

    public static bool a(byte[] A_0, byte[] A_1)
    {
        return ((RSACryptoServiceProvider) _field_h).VerifyData(A_0, "MD5", A_1);
    }

    private static void a(string A_0, Class_x A_1)
    {
        i(A_0);
        if (a(_field_j[0], _field_j[1]))
        {
            h(_field_j[0]);
            j();
            i();
            A_1._field_b = A_1._field_f > _field_a;
        }
    }

    public static bool a(string A_0, string A_1)
    {
        return a(Encoding.UTF8.GetBytes(A_0), Convert.FromBase64String(A_1));
    }

    public bool a(Action<Class_r> A_0, Class_r A_1, int A_2, out int A_3)
    {
        A_3 = this.a();
        return (this._field_b && (A_2 <= this._field_e));
    }

    public static Class_x g()
    {
        lock (typeof(Class_x))
        {
            if (_field_g == null)
            {
                _field_g = new Class_x();
                try
                {
                    Class_y.a(out _field_m, out _field_l);
                    a((string) null);
                    g(_field_m);
                    h();
                    using (_field_n)
                    {
                        a(_field_n.ReadToEnd(), _field_g);
                    }
                }
                catch (Exception)
                {
                }
            }
        }
        Class_b._field_c = _field_g._field_b;
        return _field_g;
    }

    private static void g(string A_0)
    {
        _field_o = TcpUtils.g() + _field_l;
    }

    public static byte[] g(byte[] A_0)
    {
        return ((RSACryptoServiceProvider) _field_h).Encrypt(A_0, false);
    }

    private static void h()
    {
        _field_n = new StreamReader(_field_o);
    }

    private static void h(string A_0)
    {
        _field_k = Encoding.UTF8.GetString(Convert.FromBase64String(A_0)).Split(new char[] { ';' });
    }

    private static void i()
    {
        _field_g._field_e = int.Parse(_field_k[2]);
        Class_ag._field_a = int.Parse(_field_k[2]);
        _field_g._field_f = new DateTime(long.Parse(_field_k[3]));
        Class_b._field_d = _field_g._field_f > _field_a;
    }

    private static void i(string A_0)
    {
        _field_j = A_0.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
    }

    private static void j()
    {
        _field_g._field_c = _field_k[0];
        _field_g._field_d = _field_k[1];
    }
}

